package com.ruoyi.system.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 设计状态枚举类
 */
@Getter
public enum DesignStatusEnum {
    NOT_START("排期中", "NOT_START", "#999999"),
    DESIGNING("设计中", "DESIGNING", "#1890FF"),
    FIRST_DELIVERY("一稿交付", "FIRST_DELIVERY", "#FF7D00"),
    SECOND_DELIVERY("二稿交付", "SECOND_DELIVERY", "#FFAA00"),
    COMPLETED("完成", "COMPLETED", "#00B42A"),
    PAUSED("暂停", "PAUSED", "#FF4D4F");

    private final String label;
    private final String value;
    private final String color;

    DesignStatusEnum(String label, String value, String color) {
        this.label = label;
        this.value = value;
        this.color = color;
    }

    /**
     * 根据值获取枚举
     */
    public static DesignStatusEnum getByValue(String value) {
        for (DesignStatusEnum status : values()) {
            if (status.value.equals(value)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 获取所有状态列表，用于下拉选择
     */
    public static List<StatusVO> getAllStatus() {
        List<StatusVO> list = new ArrayList<>();
        for (DesignStatusEnum status : values()) {
            list.add(new StatusVO(status.value, status.label, status.color));
        }
        return list;
    }

    /**
     * 状态VO类
     */
    public static class StatusVO {
        private String value;
        private String label;
        private String color;

        public StatusVO(String value, String label, String color) {
            this.value = value;
            this.label = label;
            this.color = color;
        }

        // getter and setter
        public String getValue() {
            return value;
        }

        public void setValue(String value) {
            this.value = value;
        }

        public String getLabel() {
            return label;
        }

        public void setLabel(String label) {
            this.label = label;
        }

        public String getColor() {
            return color;
        }

        public void setColor(String color) {
            this.color = color;
        }
    }
}
